//
//  ClubSquareModel.swift
//  77Club
//
//  Created by Apple on 2024/8/28.
//

import Foundation

struct ClubGameCircleModel: Convertible {

    /// 动态ID
    var id = ""
    /// 是否点赞
    var is_zan = false
    /// 发布内容
    var content = ""
    /// 话题
    var huati:[String] = []
    /// 图片，优先判断视频
    var img:[String] = []
    /// 视频
    var video = ""
    /// 时间
    var time = ""
    /// 查看人数
    var look = ""
    /// 评论数
    var pinglun = ""
    /// 点赞数
    var zan = ""
    /// 是否推荐
    var is_best = ""
    /// 头像
    var face = ""
    /// 昵称
    var pet_name = ""
    /// 会员图标
    var huiyuan_img = ""
    /// 头像框
    var head_frame = ""
    /// 勋章
    var medal:String = ""
    /// 颜色
    var color:[String] = []
    var videoImage:UIImage!
    var note = ""
    var note_type = 0
    var title = ""
    var uid_des = ""
    
/////////////////////////////////// 推荐游戏用
    ///
    var gid = ""
    /// 游戏图标
    var icon = ""
    /// 图片
    var image = ""
    /// 游戏名称
    var name = ""
    /// 评分
    var point = ""
    /// 游戏大小 top11位置
    var size = ""
    
    var system_type = ""
    /// 推荐指数
    var tuijianzhishu = 0.0
    /// 分类
    var type = ""
    
    var isRecommend = false
    //关联话题
    var subjects: [DynamicSubjectsModel]?
    //关联游戏
    var games: [DynamicGamesModel]?
    
    var webview_url = ""
    var share_url = ""
    var uid = ""
    var itemSize: CGSize = .zero
}


struct DynamicGamesModel: Convertible {

    var gid = ""
    var name = ""
    var icon = ""
    var biaoqian = ""
    var point = ""
}

struct DynamicSubjectsModel: Convertible {

    var subject_id = ""
    var name = ""
}

struct DynamicPostModel: Convertible {

    //用户发的帖子 uid != 0
    var uid = ""
    var news_id = ""
    var title = ""
}

struct ClubDynamicGameModel: Convertible {

    var id = ""
    var name = ""
    var number = ""//关注数
    var views = ""
    var type = "" //1.话题 2.游戏 3.帖子
    var isSel = false
    // 帖子
    var title = ""
    var fabu = ""
    var face = ""
    var range: NSRange?
}

extension ClubDynamicGameModel {
    func toTempModel() -> ClubTempDynamicGameModel {
        
        return ClubTempDynamicGameModel(
            id: self.id,
            name: self.name,
            number: self.number,
            views: self.views,
            type: self.type,
            isSel: self.isSel,
            title: self.title,
            fabu: self.fabu,
            face: self.face,
            location: self.range?.location ?? 0,
            length: self.range?.length ?? 0
        )
    }
}

struct ClubTempDynamicGameModel: Codable {

    var id = ""
    var name = ""
    var number = ""//关注数
    var views = ""
    var type = "" //1.话题 2.游戏 3.帖子
    var isSel = false
    // 帖子
    var title = ""
    var fabu = ""
    var face = ""
    var location = 0
    var length = 0
}

extension ClubTempDynamicGameModel {
    func toDynamicGameModel() -> ClubDynamicGameModel {
        
        return ClubDynamicGameModel(
            id: self.id,
            name: self.name,
            number: self.number,
            views: self.views,
            type: self.type,
            isSel: self.isSel,
            title: self.title,
            fabu: self.fabu,
            face: self.face,
            range: NSRange(location: self.location, length: self.length)
        )
    }
}

struct ClubDynamicDetailCommentModel: Convertible {

    /// 评论ID
    var id:String!
    /// xxx回复xxx
    var huifu:String!
    /// 评论内容
    var content:String!
    /// 时间
    var time:String!
    /// 点赞数
    var zan:String!
    /// 是否点赞
    var is_zan:Bool!
    /// 头像
    var face:String!
    var head_frame = ""
    /// 昵称
    var pet_name:String!
    /// 性别 0 女 1男
    var gender:NSNumber!
    /// 年龄
    var age:String!
    /// 音视频uid
    var live_uid:String!
    /// 一共有多少条评论
    var data_num:NSInteger!
    /// 二级评论
    var data:[ClubDynamicDetailCommentModel]?
    /// 颜色
    var color:[String] = []
    
    var isOpen:Bool = false
    
    var is_author = false
    
    var uid_des = ""
}

//MARK: =============广场论坛=============
struct ClubGameSquareListModel: Convertible  {
    
    var code: Int           = 0
    var message: String     = ""
    var bbs_num: Int        = 0
    var data: [ClubGameCommunityAllListModel]?
    var bbs: [ClubGameCommunityAllListModel]?
}

//MARK: =============社区=============
struct ClubGameCommunityAllListModel: Convertible, Codable  {

    var id = ""
    /// 社区名称
    var name = ""
    /// 游戏ID
    var gid = ""
    /// 简介
    var content = ""
    /// 图标
    var icon = ""
    /// 背景图
    var bgimg = ""
    /// 创建时间
    var create_time = ""
    /// 阅读量
    var look = ""
    /// 关注人数
    var guanzhu_num = ""
    var sort = ""
    var status = ""
    /// 是否关注
    var is_guanzhu = false
    /// 最新话题：
    var text = ""
    /// 是否选中
    var isSel = false
    /// bendi
    var isLocal = false
    
    var news_num = ""
    /// 收藏ID
    var shoucang_id = ""
    
    var summary = ""
    
    var is_bbs = 0
    
    var uid_des = ""
}

struct ClubGameCommunityModel: Convertible  {
    
    /// 背景
    var bgimg = ""
    /// 分类
    var fenlei:[ClubGameCommunityFenLeiModel] = []
    /// 论坛成员数
    var guanzhu_num = 0
    /// 图标
    var icon = ""
    /// 是否关注
    var is_guanzhu = false
    /// 名称
    var name = ""
    /// 最新发布时间
    var new_time = ""
    /// 新闻
    var news:[ClubGameCommunityNewsModel] = []
    /// 收藏ID
    var shoucang_id = ""
    /// 一句话描述
    var summary = ""
    /// 论坛介绍
    var content = ""
    /// 论坛公告
    var notice = ""
    /// 1.塔主 2.管理员 3.普通人
    var my_role = 0
    /// 禁言用户数量
    var ban_num = 0
    /// 管理员数量
    var admin_num = 0
    /// 论坛禁言
    var is_ban = 0
    /// 塔主信息
    var master_user: ClubForumMemberModel?
    /// 管理员权限
    var perms: ClubForumAdminPermModel?
    /// 关注设置
    var settings = ""
    /// 关注显示：1=实际人数，2=虚拟人数
    var system_type = ""
    
    var share_url = ""
    
    var bbs_num = ""
}

struct ClubGameCommunityFenLeiModel: Convertible  {
    
    var name = ""
    var type = ""
    var isSel = false
}

struct ClubGameCommunityNewsModel: Convertible  {
    
    /// 分类ID
    var class_id = ""
    /// id
    var id = ""
    /// 名称
    var title = ""
    /// 分类
    var type = ""
    /// 判断是否是用户发帖
    var uid = ""
}

struct ClubSquareDetailPostModel: Convertible  {
    
    var code: Int           = 0
    var message: String     = ""
    var data: [ClubGameCommunityListModel]?
    var bests: [ClubGameCommunityListModel]?
}

struct ClubGameCommunityListModel: Convertible {

    /// 文章ID
    var id = ""
    /// 标题
    var title = ""
    /// 内容
    var content = ""
    /// 发布时间
    var time = ""
    /// 点赞量
    var good = ""
    /// 查看量
    var look = ""
    /// 图片
    var image:[String] = []
    /// 视频  优先判断 为空时再看图片
    var video = ""
    /// 最后回复时间
    var last_time = ""
    /// 发布人
    var fabu = ""
    /// 头像
    var face = ""
    /// 标签
    var biaoqian = ""
    /// 优质帖子图片
    var jiajing_img = ""
    /// 是否允许删除
    var del = false
    /// 社区ID
    var pid = ""
    /// 是否点赞
    var is_good = false
    /// 是否评论
    var is_pinglun = false
    /// 是否加精  加精显示 加精图片
    var is_jiajing = false
    /// 分类名称，优先显示加精 置顶
    var className = ""
    /// 是否置顶
    var is_best = 0
    /// 评论数
    var pinglun = ""
    var type = ""
    var webview_url = ""
    var uid = ""
    var timetran = ""
    //关联话题
    var subjects: [DynamicSubjectsModel]?
    //关联游戏
    var games: [DynamicGamesModel]?
    //关联帖子
    var bbss: [DynamicPostModel]?
    //身份 1.塔主 2.管理员 0.普通用户
    var user_role = 0
    //帖子是否被下架 -1下架
    var status = 0
    //分享
    var share_url = ""
    
    var uid_des = ""
    
    var content_h5 = ""
    
    var isLoad = false
}

//社区Model
struct ClubStrategyModel: Convertible {
    
    var code: Int           = 0
    var message: String     = ""
    var blocks: [ClubStrategyBlockModel]?
    var data: [ClubGameCommunityListModel]?
}

struct ClubStrategyBlockModel: Convertible {
    
    var id = 0
    var name = ""
    var shequ_id = 0
    var sortby = 0
    var image = 0 //是否有图片
    var news: [ClubStrategyBlockItemModel]?
}

struct ClubStrategyBlockItemModel: Convertible {
    
    var news_id = ""
    var title = ""
    var image = ""
    var width = 0.0
}

struct ClubGameCommunityDetailModel: Convertible {

    /// 文章ID
    var id = ""
    /// 标题
    var title = ""
    /// 发布人uid
    var uid = ""
    /// 类型ID
    var class_id = ""
    /// 类型名称
    var className = ""
    /// 社区ID
    var pid = ""
    /// 图片 数组
    var image:[String] = []
    /// 排序
    var sort = ""
    /// 发布时间
    var time = ""
    /// 最后回复时间
    var last_time = ""
    /// 是否置顶
    var is_best = false
    /// 是否加精
    var is_jiajing = false
    /// 是否点赞
    var is_good = false
    /// 视频
    var video = ""
    /// 内容 base64
    var content = ""
    /// 点赞量
    var good = ""
    /// 查看量
    var look = ""
    var status = ""
    /// 发布人
    var fabu = ""
    /// 头像
    var face = ""
    /// 标签
    var biaoqian = ""
    /// 优质图片
    var jiajing_img = ""
    /// 评论数
    var pinglun = ""
    /// 网页高度
    var webViewH = 0.0
    
    var uid_des = ""
    
    var share_url = ""
    
    var game: ClubNewHomeGameModel?
    /// 内容
    var content_h5 = ""
    /// 关联话题
    var subjects: [DynamicSubjectsModel]?
    /// 关联游戏
    var games: [DynamicGamesModel]?
    /// 关联帖子
    var bbss: [DynamicPostModel]?
    
    var cellH = 0.0
    /// 是否收藏
    var is_shoucang = 0
    /// 是否被禁言
    var is_ban = 0
    
//    func mapping(mapper: HelpingMapper) {
//        mapper <<<
//            self.className <-- "class"
//    }
}

struct ClubGameCommunityDetailCommentModel: Convertible {

    /// 评论id
    var id = ""
    /// 评论用户uid
    var uid = ""
    var uid_des = ""
    /// 文章id
    var pid = ""
    /// 文章发布者
    var puid = ""
    var type = ""
    /// 评论内容
    var content = ""
    /// 点赞量
    var good = ""
    /// 回复时间
    var time = ""
    var status = ""
    /// 昵称
    var pet_name = ""
    /// 头像
    var face = ""
    /// 是否点赞
    var is_good = false
    
    /// 被回复人
    var p_pet_name = ""
    
    var is_author = false
    
    var list:[ClubGameCommunityDetailCommentModel] = []
    
//    func mapping(mapper: HelpingMapper) {
//        mapper <<<
//            self.hid <-- "id"
//    }
}


struct ClubOpenServiceModel: Convertible {

    /// 区服名称
    var server_name = ""
    /// 时间戳
    var create_time = ""
    /// 月日
    var time1 = ""
    /// 时分
    var time2 = ""
    /// 开服状态
    var type = ""
}
